import Vue from 'vue'
import App from './App.vue'
import router from './router'

let instance = null;
function render(props = {}){
  const { container } = props
  instance = new Vue({
    router,
    render: h => h(App)
  }).$mount(container? container.querySelector('#app') :'#app') //这里还是关押在到自己的html上，基座会拿到这个挂载后的html，将其插入
}

if(window.__POWERED_BY_QIANKUN__){ //如果是qiankun使用
  __webpack_public_path__ = window.__INJECTED_PUBLIC_PATH_BY_QIANKUN__; //动态加载public_path
}
if(!window.__POWERED_BY_QIANKUN__){render()} //独立运行

export async function bootstrap(){}
export async function mount(props){
  console.log(props);
  render(props);
}
export async function unmount(){instance.$destroy();}

